<template>
	<view class="header">请求封装，在service/request.js中</view>
	<view class="wrapper">
		{{reqData}}
	</view>
	<button type="primary" @click="sendRequest">发起一个请求</button>
</template>

<script setup>
import {ref} from 'vue'
import request from '@/service/request'

const reqData = ref(null)

async function sendRequest() {
	const res = await request({
		url: 'https://test.hnchengyue.com/charging/products/list',
		method: 'post'
	})
	
	reqData.value = JSON.stringify(res) || '空'
}
</script>

<style lang="scss">
@import '../wrapper.scss';
</style>